package com.todo.pro.enums;

public enum PlanStatusEnum {

	Finish("Finish", "已完成"), HaveInHand("HaveInHand", "进行中"), Delay("Delay", "已延期"), Cancel("Cancel", "已取消");

	private String code;
	private String name;

	public String code() {
		return code;
	}

	private PlanStatusEnum(String code, String name) {
		this.code = code;
		this.name = name;
	}

	public static String getStatusNameByCode(String status) {
		if (status == null) {
			return HaveInHand.name;
		}
		for (PlanStatusEnum e : PlanStatusEnum.values()) {
			if (status.equals(e.code)) {
				return e.name;
			}
		}
		return HaveInHand.name;
	}

	public static boolean isHaveInHand(String status) {
		if (status == null) {
			return false;
		}
		if (status.equals(HaveInHand.code)) {
			return true;
		}
		return false;
	}

	public static boolean isDelay(String status) {
		if (status == null) {
			return false;
		}
		if (status.equals(Delay.code)) {
			return true;
		}
		return false;
	}
}
